<template>
	<view class="pagesMain">
		<!-- 头部 -->
		<block v-if="!isloading">
			<pagesTop ref='pagesTop' :isShowUserInfo='isShowUserInfo' :isLogin='isLogin' type="2"></pagesTop>
			<view class="pagesMain-content" v-if="isPatient==1&&patientHospital.patientId&&listArrCom.length>0">
				<view class="pagesMain-content_title display_flex_bet" >
					个人中心
					<text class="pagesMain_module_moduleBtn" @tap="backGuidPage">返回</text>
				</view>
				<u-grid :border="false" col="4">
					<u-grid-item v-for="(listItem,listIndex) in listArrCom" :key="listIndex"
						:class="(patientHospital.patientId==undefined||patientHospital.patientId==null||patientHospital.patientId=='')||(listItem.text=='我的随访')?'gridActive':''"
						@tap="gridEvent(listItem,listIndex)" class="grid-Item" >
						<view class="badgeBox">
							<u-badge class='appointmentNumBadge' type="warning" v-if="listItem.text=='我的预约'"
								:value="appointmentNum"></u-badge>
							<u-badge class='appointmentNumBadge' type="warning" v-if="listItem.text=='温馨提示'"
								:value="warmReminderNum"></u-badge>
							<u-badge class='appointmentNumBadge' type="warning" v-if="listItem.text=='我的医生'"
								:value="myDoctorNum"></u-badge>
							<u--image :src="listItem.icon" width="100rpx" height="100rpx" shape="circle"></u--image>
						</view>
						<text class="grid-text">{{listItem.text}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="pagesMain-content" v-if="isPatient==1&&listArr1Com.length>0">
				<view class="pagesMain-content_title ">
					门诊服务
				</view>
				<view class="appointmentPhoneListBox" v-if="filterRoleMenus('预约电话和工作时间')">
					<view class="pagesMain-content_title_tip" v-if="appointmentPhoneList.length>0">
						<view class="pagesMain-content_title_tip_left">
							预约电话：
						</view>
						<view class="">
							<view class="pagesMain-content_title_tip_right" v-for="(item,index) in appointmentPhoneList" :key="index">
								<view @tap="callPhone(item.appointmentPhone)">
									<text>{{item.appointmentPhone}}</text>
									<text v-if="item.appointmentAddress">({{item.appointmentAddress}})</text>
								</view>
							</view>
						</view>
						
					</view>
					<view class="pagesMain-content_title_dec" v-if="patientHospital.workingHours">
						<!-- 工作时间：上午08:00 — 12:00;下午{{endOpenTime}} -->
						工作时间：{{patientHospital.workingHours}}
					</view>
				</view>
				
				<u-grid :border="false" col="4">
					<u-grid-item v-for="(listItem,listIndex) in listArr1Com" :key="listIndex" class="grid-Item"
						@tap="gridEvent(listItem,listIndex)" :class="listItem.text=='签到'?'gridActive':''">
						<view class="badgeBox">
							<u-badge class='totalNoreadnum' type="warning" v-if="listItem.text=='消息'"
								:value="totalNoreadnum"></u-badge>
							<u--image :src="listItem.icon" width="100rpx" height="100rpx" shape="circle"></u--image>
						</view>
						<text class="grid-text">{{listItem.text}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="pagesMain-content" v-if="isPatient==1&&listArr2Com.length>0">
				<view class="pagesMain-content_title">
					机构介绍
				</view>
				<u-grid :border="false" col="4">
					<u-grid-item v-for="(listItem,listIndex) in listArr2Com" :key="listIndex" class="grid-Item"
						@tap="gridEvent(listItem,listIndex)" >
						<u--image :src="listItem.icon" width="100rpx" height="100rpx" shape="circle"></u--image>
						<text class="grid-text">{{listItem.text}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="pagesMain-content" v-if="isPatient!=1&&listArr3Com.length>0">
				<view class="pagesMain-content_title">
					医生服务
				</view>
				<u-grid :border="false" col="4">
					<u-grid-item v-for="(listItem,listIndex) in listArr3Com" :key="listIndex" class="grid-Item"
						@tap="gridEvent(listItem,listIndex)">
						<view class="badgeBox">
							<u-badge class='totalNoreadnum' type="warning" v-if="listItem.text=='消息'"
								:value="totalNoreadnum"></u-badge>
							<u--image :src="listItem.icon" width="100rpx" height="100rpx" shape="circle"></u--image>
						</view>
						<text class="grid-text">{{listItem.text}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="pagesMain-content" v-if="isPatient!=1&&user.showAllCustomers==1&&listArr4Com.length>0">
				<view class="pagesMain-content_title">
					数据中心
				</view>
				<u-grid :border="false" col="4">
					<u-grid-item v-for="(listItem,listIndex) in listArr4Com" :key="listIndex" class="grid-Item"
						:class="(listItem.text=='我的报表')?'gridActive':''"
						@tap="gridEvent(listItem,listIndex)" >
						<u--image :src="listItem.icon" width="100rpx" height="100rpx" shape="circle"></u--image>
						<text class="grid-text">{{listItem.text}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="pagesMain-content" v-if="isPatient!=1&&listArr5Com.length>0">
				<view class="pagesMain-content_title">
					机构介绍
				</view>
				<u-grid :border="false" col="4">
					<u-grid-item v-for="(listItem,listIndex) in listArr5Com" :key="listIndex" class="grid-Item"
						@tap="gridEvent(listItem,listIndex)" >
						<u--image :src="listItem.icon" width="100rpx" height="100rpx" shape="circle"></u--image>
						<text class="grid-text">{{listItem.text}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="pagesMain-content-ann" v-if="filterRoleMenus('宣教公告')">
				<Announcement :hospitalId="patientHospital.deptId"></Announcement>

			</view>

		</block>

		<!-- loading动画 -->
		<u-loading-icon mode="circle" inactive-color="red" v-else></u-loading-icon>
		<view class="pagesMain_module_moduleBtnPosition" @tap="backGuidPage" v-if="isPatient==1">
			<!-- 返回 -->
			<u-icon name="grid" color="#ffffff" size="30"></u-icon>
		</view>
		<view class="pagesMain_module_moduleBtnPositionOther" @tap="openIdentity" v-if="isPatientA==2">
			<!-- 返回 -->
			{{isPatient===1?'顾客':'医生'}}
			<u-icon name="arrow-right" color="#fff"></u-icon>
		</view>

		<u-popup :show="showIdentity" @close="closeIdentity" mode="center" closeable round="10">
			<view class="popupBox">
				<u-button color="linear-gradient(to right, rgb(103, 161, 255), rgb(73, 185, 173))"
					:disabled="isPatient==0" size="small" @click="switchIdentity(0)">医生身份</u-button>
				<u-button color="linear-gradient(to right, rgb(103, 161, 255), rgb(73, 185, 173))"
					:disabled="isPatient==1" size="small" @click="switchIdentity(1)">顾客身份</u-button>
			</view>
		</u-popup>

		<u-popup :show="showpatientPopup" mode="center" :round="40" :closeable="true" @close="closepatientPopup">
			<patientSelect v-if="showpatientPopup" :patientArr="patientArr" @comfirm="comfirmPatient"></patientSelect>
		</u-popup>



	</view>
</template>

<script>
	import {
		getToken
	} from '@/common/auth'
	import pagesTop from "@/components/pagesTop/pageTop.vue"; //头部信息
	import {
		appointMentApi
	} from '@/api/appointMent/appointMent.js'
	import * as SSKEYS from '@/common/session-storage-keys'
	import Announcement from '@/subPackages/introduce/announcement/index.vue'
	import {
		WarmReminderClassApi
	} from '@/api/warmReminder/warmReminder.js'
	import {
		UserApi
	} from '@/api/system/user-api.js'
	import patientSelect from "@/components/patientSelect.vue"; //病人选择
	import {
		mapState
	} from 'vuex'
	export default {
		components: {
			pagesTop,
			Announcement,
			patientSelect
		},
		
		data() {
			return {
				showpatientPopup: false,
				isloading: true,
				isLogin: false,
				isShowUserInfo: false,
				listArr: [{
						icon: '/static/images/indexReset/index-1.png',
						text: '我的预约'
					},
					{
						icon: '/static/images/indexReset/index-2.png', //河南省医院不展示该项
						text: '我的资料'
					},
					{
						icon: '/static/images/indexReset/index-4.png',
						text: '我的顾客码'
					}, {
						icon: '/static/images/indexReset/index-3.png',
						text: '我的随访'
					}, {
						icon: '/static/images/indexReset/index-5.png',
						text: '温馨提示'
					}, {
						icon: '/static/images/indexReset/index-6.png',
						text: '个人信息'
					},
					{
						icon: '/static/images/indexReset/index-11.png',
						text: '我的医生'
					},
					{
						icon: '/static/images/indexReset/index-2.png',
						text: '照片上传'
					}
				],
				listArr1: [{
						icon: '/static/images/indexReset/index-7.png',
						text: '治疗预约'
					},
					{
						icon: '/static/images/indexReset/index-8.png',
						text: '登记'
					}, 
					{
						icon: '/static/images/indexReset/index-9.png',
						text: '签到'
					},
					{
						icon: '/static/images/indexReset/index-11.png',
						text: '医生咨询'
					},
					{
						icon: '/static/images/indexReset/index-6.png',
						text: '消息'
					}
				],
				listArr2: [{
						icon: '/static/images/indexReset/index-10.png',
						text: '医院介绍'
					}, {
						icon: '/static/images/indexReset/index-11.png',
						text: '专家介绍'
					},
					// {
					// 	icon: '/static/images/indexReset/index-12.png',
					// 	text: '宣教公告'
					// },
				],
				listArr3: [{
					icon: '/static/images/indexReset/index-13.png',
					text: '顾客管理'
				}, {
					icon: '/static/images/indexReset/index-11.png',
					text: '医生咨询'
				}, {
					icon: '/static/images/indexReset/index-6.png',
					text: '消息'
				}],
				listArr4: [{
					icon: '/static/images/indexReset/index-14.png',
					text: '我的报表'
				}, {
					icon: '/static/images/indexReset/index-15.png',
					text: '科室报表'
				}, {
					icon: '/static/images/indexReset/index-16.png',
					text: '今日动态'
				}, {
					icon: '/static/images/indexReset/index-14.png',
					text: '专病分析'
				}, {
					icon: '/static/images/indexReset/index-16.png',
					text: '顾客分析'
				}],
				listArr5: [{
						icon: '/static/images/indexReset/index-10.png',
						text: '医院介绍'
					}, {
						icon: '/static/images/indexReset/index-11.png',
						text: '专家介绍'
					}
				],


				selectDoctorIndex: 0,
				selectDoctorObj: {},
				subsectionIndex: 2,

				patientHospital: {},
				isPatient: 1, //0医生,1顾客
				isPatientA: 0, //2 医生和顾客
				currentText: '',
				appointmentNum: 0, //我的预约的角标
				user: {},
				totalNoreadNumber: 0,
				showIdentity: false,
				token: '',
				endOpenTime: '',
				timeType: '夏令时',
				warmReminderNum: 0, //温馨提示的角标
				myDoctorNum: 0, //我的医生的角标
				type: 0, // 0:默认全流程  1:banner 入口  2:曾就诊,曾预约 banner 入口(单个医院) 3:曾就诊,曾预约 banner 入口(多个医院) 4:从医美多选页多个就诊人进入
				detpId: '', //从霏图皮博士2Banner入口  传递过来的医院id

				patientArr: [],
				selectHospital: {},
				doctorRoleMenusSelect: [],
				customerRoleMenusSelect: [],
				appointmentPhoneList:[],

			}
		},
		computed: {
			...mapState({
				chat: state => state.user.chat,
				totalNoreadnum: state => state.user.totalNoreadnum
			}),
			listArrCom(){
				return this.listArr.filter(item=>{
					return this.customerRoleMenusSelect.includes(item.text)
				})
			},
			listArr1Com(){
				return this.listArr1.filter(item=>{
					return this.customerRoleMenusSelect.includes(item.text)
				})
			},
			listArr2Com(){
				return this.listArr2.filter(item=>{
					return this.customerRoleMenusSelect.includes(item.text)
				})
			},
			listArr3Com(){
				return this.listArr3.filter(item=>{
					return this.doctorRoleMenusSelect.includes(item.text)
				})
			},
			listArr4Com(){
				return this.listArr4.filter(item=>{
					return this.doctorRoleMenusSelect.includes(item.text)
				})
			},
			listArr5Com(){
				return this.listArr5.filter(item=>{
					return this.doctorRoleMenusSelect.includes(item.text)
				})
			},
		},
		onLoad(options) {
			if (options.token) {
				// uni.clearStorageSync()
				uni.setStorageSync('App-Token', options.token)
				this.token = options.token
				//#ifdef H5
				uni.setStorageSync(SSKEYS.ACCOUNT_APPLICATION_PLATFORM_KEY, 'H5')
				//#endif

				// #ifdef APP-PLUS
				uni.setStorageSync(SSKEYS.ACCOUNT_APPLICATION_PLATFORM_KEY, 'APP-PLUS')
				// #endif

				// #ifdef MP-WEIXIN
				uni.setStorageSync(SSKEYS.ACCOUNT_APPLICATION_PLATFORM_KEY, 'MP-WEIXIN')
				// #endif
				// console.log('options.token', options.token)
			} else {
				this.token = ''
			}
			// if (options.type == 1) {
			// 	this.type = 1 // 0:默认全流程  1:banner 入口  2:曾就诊,曾预约 banner 入口(单个医院) 3:曾就诊,曾预约 banner 入口(多个医院)
			// 	console.log("options.type" + options.type)
			// } 
			if(options.type){
				this.type= Number(options.type)
			}
			if(options.deptId){
				this.detpId = Number(options.deptId)
			}

		},
		onShow() {
			this.isloading = true
			//#ifdef H5

			let local = location.href

			if (local.indexOf('/#/') > -1) { //?hospitalId=219
				let id = this.getParam(local, 'hospitalId')
				uni.redirectTo({
					url: '/subPackages/remind/medicalInfo/index?hospitalId=' + id
				})
				return false
			}
			//#endif
			this.loginSuccess()

			let date = new Date();
			let currentMonth = date.getMonth() + 1;
			if (currentMonth > 4 && currentMonth < 10) {
				this.endOpenTime = '15:00 — 18:00'
				this.timeType = '夏令时'
			} else {
				this.endOpenTime = '14:30 — 17:30'
				this.timeType = '冬令时'
			}

			if (getToken()) {
				this.isLogin = true
				this.isShowUserInfo = false
			}
			// this.chat.updateBadge()
		},
		methods: {
			filterRoleMenus(text) {
				if (this.isPatient === 0) {
					return this.doctorRoleMenusSelect.includes(text)
				} else if (this.isPatient === 1) {
					return this.customerRoleMenusSelect.includes(text)
				}

			},
			getMyDoctorList() {
				UserApi.getMyDoctor(this.patientHospital.patientId).then((response) => {
					if (response.code == 200) {
						if (response.data.length > 0) {
							this.myDoctorNum = response.data.length
						}
					}
				})

			},
			//    默认医院入口
			comfirmPatient(data) {

				this.showpatientPopup = false
				let obj = {
					patientId: data ? data : '',
					...this.selectHospital
				}
				if (uni.getStorageSync('patientHospital').deptId != obj.deptId) {
					uni.setStorageSync('isAgree', 0)
				}
				uni.setStorageSync('patientHospital', obj) //缓存就诊医院信息
				this.refreshData()
			},
			closepatientPopup() {
				this.showpatientPopup = false
			},
			getAllHospital(reType) {
				appointMentApi.getAllHospital({
					miniProgramShow: 1
				}).then((response) => {
					if (response.code == 200) {
						let data = response.data

						if (this.type == 1) {
							data.forEach(item => {
								if (item.deptName.indexOf('河南省人民医院') > -1) {
									this.selectHospital = item
								}

							})
						} else if (this.type == 2) {
							data.forEach(item => {
								if (item.deptId == this.detpId) {
									this.selectHospital = item
								}

							})
						}  else if (this.type == 3) {
							uni.redirectTo({
								url: '/pages/index/guidePage'
							})
							return false
						} else if (this.type == 4) {
							if(uni.getStorageSync('patientHospital')){
								this.refreshData()
								return false
							}
							
						} else {
							if (reType == 1) {
								if ((uni.getStorageSync('patientHospital') == undefined ||
										uni.getStorageSync('patientHospital') == null ||
										uni.getStorageSync('patientHospital') == '')) {
									if (JSON.parse(uni.getStorageSync('hospital')).deptId == 100) {
										// this.selectHospital = JSON.parse(uni.getStorageSync('hospital'))

									} else {
										data.forEach(item => {
											if (item.deptId == JSON.parse(uni.getStorageSync('hospital'))
												.deptId) {
												this.selectHospital = item
											}
										})
									}
								} else {
									data.forEach(item => {
										if (item.deptId == uni.getStorageSync('patientHospital').deptId) {
											this.selectHospital = item
										}
									})

								}

							}


						}
						if (this.selectHospital && this.selectHospital.deptId) {

							this.getpatientHospital(JSON.parse(uni.getStorageSync('user')).phonenumber)
						} else {
							console.log('进来=====')

							uni.redirectTo({
								url: '/pages/index/guidePage'
							})
							return false
						}


					} else {
						this.$modal.showToast(response.msg)
					}
				})

			},
			getpatientHospital(phone) {
				appointMentApi.getpatientHospital({
					patientPhone: phone
				}).then((response) => {
					if (response.code == 200) {
						let data = response.data
						console.log('data---', data)
						let that = this
						if (data && data.length > 0) {
							data.forEach(function(ele) {
								if (ele.hospitalId == that.selectHospital.deptId) {
									that.patientArr = ele.patients
								}
							})
						}
						if (that.patientArr.length > 1) { //多个用户  patientId 弹窗点选
							if (uni.getStorageSync('patientHospital').patientId == null || uni.getStorageSync(
									'patientHospital').patientId == undefined || uni.getStorageSync(
									'patientHospital').patientId == '') {
								that.showpatientPopup = true
							}else{
								this.refreshData()
							}

						} else {
							let obj = {
								patientId: that.patientArr[0] ? that.patientArr[0].patientId : '',
								...that.selectHospital
							}
							if (uni.getStorageSync('patientHospital').deptId != obj.deptId) {
								uni.setStorageSync('isAgree', 0)
							}
							uni.setStorageSync('patientHospital', obj) //缓存就诊医院信息
							that.refreshData()
						}
					} else {
						this.$modal.showToast(response.msg)
					}
				})
			},

			//  end
			getTipsList() {
				WarmReminderClassApi.getTipsList({
					pageNum: 1,
					pageSize: 9999,
					patientId: this.patientHospital.patientId
				}).then((response) => {
					if (response.code == 200) {
						this.warmReminderNum = response.total

					}
				});
			},
			callPhone(str) {
				uni.makePhoneCall({
					phoneNumber: str //仅为示例
				});
			},
			getParam(path, name) {
				var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
				if (reg.test(path))

					return unescape(RegExp.$2.replace(/\+/g, " "));

				return "";

			},


			async loginSuccess() {
				if (this.token) {
					const {
						code,
						user
					} = await this.$store.dispatch('GetInfo')
					if (code === 200 && !this.chat) {
						this.$store.dispatch("initLogin")
					}
				}
				await this.loginSet()

			},
			loginSet() {
				if (uni.getStorageSync('user')) {
					this.user = JSON.parse(uni.getStorageSync('user'))

				}
				// console.log(uni.getStorageSync('isPatient'))
				if (uni.getStorageSync('isPatient') != undefined && uni.getStorageSync('isPatient') != null) {
					this.isPatient = uni.getStorageSync('isPatient')
				}
				if (uni.getStorageSync('isPatientA') != undefined && uni.getStorageSync('isPatientA') != null) {
					this.isPatientA = uni.getStorageSync('isPatientA')
				}
				if (this.isPatient === 0) { //医生
					if (uni.getStorageSync('hospital')) {
						this.patientHospital = JSON.parse(uni.getStorageSync('hospital'))
						uni.setStorageSync('patientHospital', this.patientHospital)
						this.getRoleMenusSelect()
					}
					this.isloading = false
				} else { //病人
				   if (uni.getStorageSync('hospital')) {
				   	    this.getAllHospital(1)
				   }else{
						uni.redirectTo({
							url: '/pages/index/guidePage'
						})
				   }
				
					// if (this.type != 1) {
					// 	this.getAllHospital(1)
					// }
					// console.log('===================================================')
					// console.log(uni.getStorageSync('patientHospital'))
					// if ((uni.getStorageSync('patientHospital') == undefined ||
					// 		uni.getStorageSync('patientHospital') == null ||
					// 		uni.getStorageSync('patientHospital') == '')) {
					// 	if (this.type == 1) {
					// 		this.getAllHospital()
					// 	}else if (this.type == 2) {
					// 		this.getAllHospital()
					// 	} else {
					// 		uni.redirectTo({
					// 			url: '/pages/index/guidePage'
					// 		})
					// 		return false
					// 	}

					// } else {
					// 	if (this.type == 1) {
					// 		this.getAllHospital(1)
					// 	}else if(this.type == 2){
					// 		this.getAllHospital(1)
					// 	}
					// 	this.patientHospital = uni.getStorageSync('patientHospital')
					// 	if (this.patientHospital.patientId) {
					// 		this.getUserAppointmentNum()
					// 		this.getTipsList()
					// 		this.getMyDoctorList()
					// 	}
					// 	this.getRoleMenusSelect()
					// 	this.isloading = false
					// }

				}

			},
			getRoleMenusSelect() {
				if (this.patientHospital.doctorRoleMenusSelect) {
					this.doctorRoleMenusSelect = this.patientHospital.doctorRoleMenusSelect.split(',')
				} else {
					this.doctorRoleMenusSelect = []
				}
				if (this.patientHospital.customerRoleMenusSelect) {
					this.customerRoleMenusSelect = this.patientHospital.customerRoleMenusSelect.split(',')
				} else {
					this.customerRoleMenusSelect = []
				}
			},
			getAppointmentPhoneList(){
				if(this.patientHospital.appointmentPhoneList&&JSON.parse(this.patientHospital.appointmentPhoneList).length>0 ){
					this.appointmentPhoneList=JSON.parse(this.patientHospital.appointmentPhoneList) 
				}
			},
			
			refreshData() {
				this.patientHospital = uni.getStorageSync('patientHospital')
				if (this.patientHospital.patientId) {
					this.getUserAppointmentNum()
					this.getTipsList()
					this.getMyDoctorList()
				}
				this.getRoleMenusSelect()
				this.getAppointmentPhoneList()

				this.isloading = false

			},
			closeIdentity() {
				console.log('closeIdentity----')
				this.showIdentity = false
				this.$refs.pagesTop.refresh()
			},
			switchIdentity(num) {
				if (num === 1) {
					if (this.type == 1) {
						uni.setStorageSync('isPatient', 1)
						this.isPatient = 1
						this.getAllHospital()
						// console.log("切花了")
					} else {
						uni.setStorageSync('isPatient', 1)

						uni.redirectTo({
							url: '/pages/index/guidePage'
						})
					}


				} else {
					uni.setStorageSync('isPatient', 0)
					this.loginSuccess()
					// this.chat.updateBadge()
				}
				this.closeIdentity()
			},
			openIdentity() {
				this.showIdentity = true
			},
			backGuidPage() {
				uni.redirectTo({
					url: '/pages/index/guidePage'
				})
			},
			gridEvent(item, index) {
				this.currentText = item.text
				// this.patientHospital.patientId=483
				if (item.text != '医院介绍' && item.text != '专家介绍' && item.text != '治疗预约'&& item.text != '登记' && item.text != '医生咨询' && item
					.text != '我的医生' && item.text != '消息' && this.isPatient == 1) { //病人进入
					if (this.patientHospital.patientId == '' || this.patientHospital.patientId == undefined || this
						.patientHospital.patientId == null) {
						this.$modal.showToast('您还未登记~，请先登记个人信息~')
						return false
					}
				} else if (item.text == '医院介绍' && item.text == '专家介绍') {
					if (this.patientHospital.deptId == '' || this.patientHospital.deptId == undefined || this
						.patientHospital.deptId == null) {
						this.$modal.showToast('您还未选择医院~，请先选择医院~')
						return false
					}
				}

				if (item.text == '治疗预约') {
					this.$tab.navigateTo('/subPackages/appointTreat/agree')
				} else if (item.text == '温馨提示') {
					// this.$tab.navigateTo('/subPackages/mine/customer/remind')

					this.$tab.navigateTo(
						`/subPackages/mine/reminder/index?patientId=${this.patientHospital.patientId}`)
				} else if (item.text == '我的资料') {
					this.$tab.navigateTo(
						`/subPackages/mine/customer/infomation?patientId=${this.patientHospital.patientId}`)
				} else if (item.text == '个人信息') {
					if (this.user) {
						this.$tab.navigateTo(`/subPackages/mine/info/index?userId=${this.user.userId}`)
					}
					// this.$modal.showToast('模块建设中~')
					// this.$tab.navigateTo(`/subPackages/mine/info/index?patientId=${this.patientHospital.patientId}`)
				} else if (item.text == '我的顾客码') {
					this.$tab.navigateTo(`/subPackages/mine/customer/code?patientId=${this.patientHospital.patientId}`)
				} else if (item.text == '我的医生') {
					this.$tab.navigateTo(
						`/subPackages/message/consolutionMyList?patientId=${this.patientHospital.patientId}`);
				} else if (item.text == '照片上传') {
					this.$tab.navigateTo(`/subPackages/mine/photoUpload/index?patientId=${this.patientHospital.patientId}`);
				} else if (item.text == '我的随访') {
					this.$modal.showToast('模块建设中~')
				} else if (item.text == '顾客管理') {
					if (this.user) {
						this.$tab.navigateTo(
							`/subPackages/mine/customer/manage?hospitalId=${this.patientHospital.deptId}&userName=${this.user.userName}&showAllCustomers=${this.user.showAllCustomers}`
						)
					}
				} else if (item.text == '医生咨询') {
					this.$tab.navigateTo(`/subPackages/message/consolutionList?deptId=${this.patientHospital.deptId}`);
				} else if (item.text == '消息') {
					this.$tab.navigateTo('/subPackages/message/history');
				} else if (item.text == '医院介绍') {
					this.$tab.navigateTo('/subPackages/introduce/hospital/index');
				} else if (item.text == '专家介绍') {
					this.$tab.navigateTo(`/subPackages/introduce/expert/index?deptId=${this.patientHospital.deptId}`);
				} else if (item.text == '我的报表') {
					this.$modal.showToast('我的报表 模块建设中~')
				} else if (item.text == '我的预约') {
					this.$tab.navigateTo('/subPackages/appointTreat/appointTime')
				} else if (item.text == '咨询我的') {
					this.$modal.showToast('咨询我的 模块建设中~')
				} else if (item.text == '科室报表') {
					//this.$modal.showToast( '科室报表 模块建设中~')
					this.$tab.navigateTo('/subPackages/mine/depart/report')
				} else if (item.text == '今日动态') {
					this.$tab.navigateTo('/subPackages/mine/depart/todayStatistics')
				} else if (item.text == '专病分析') {
					this.$tab.navigateTo('/subPackages/mine/depart/diseaseAnalys')
				} else if (item.text == '顾客分析') {
					this.$tab.navigateTo('/subPackages/mine/depart/customerAnaiys')
				} else if (item.text == '医护申请') { //medicale/applicate
					this.$tab.navigateTo('/subPackages/mine/medicale/applicate')
				} else if (item.text == '医护审核') {
					this.$tab.navigateTo('/subPackages/mine/medicale/review')
				} else if (item.text == '登记') { //medicale/applicate
					this.$tab.navigateTo(`/subPackages/remind/medicalInfo/index?hospitalId=${this.patientHospital.deptId}`)
				} else if (item.text == '签到') {
					//this.$tab.navigateTo('/subPackages/remind/medicalInfo/report')
					this.$modal.showToast('模块建设中~')
				}
				// this.$modal.showToast(item.text)
			},

			moreEvent() {
				this.$modal.showToast('模块建设中~')
			},

			toAppointTreatPage() {
				this.showPopup = false
				if (this.currentText == '治疗预约') {
					this.$tab.navigateTo('/subPackages/appointTreat/agree')
				} else if (this.currentText == '我的预约') {
					this.$tab.navigateTo('/subPackages/appointTreat/appointTime')
				}
			},
			getUserAppointmentNum() {
				appointMentApi.getUserAppointmentNum({
					patientId: this.patientHospital.patientId
				}).then(response => {
					if (response.code == 200) {
						this.appointmentNum = response.data
					}
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.pagesMain {
		padding-bottom: 30rpx;

		.pagesMain_module_moduleBtn {
			color: $uni-text-color-inverse;
			border: 1px solid rgba(250, 188, 34, 1);
			background: rgba(250, 188, 34, 1);
			box-shadow: 0 2px 12px 0 rgba(250, 188, 34, .8);
			padding: 6rpx 16rpx;
			border-radius: 8rpx;
			display: none;
		}

		.pagesMain_module_moduleBtnPosition {
			position: fixed;
			right: 24rpx;
			bottom: 260rpx;
			width: 100rpx;
			height: 100rpx;
			color: $uni-text-color-inverse;
			background: #49B9AD;
			border-radius: 180rpx;
			text-align: center;
			line-height: 100rpx;
			box-shadow: 0 2px 12px 0 rgba(73, 185, 173, .8);
			justify-content: center;
			display: flex;
		}

		.pagesMain_module_moduleBtnPositionOther {
			position: fixed;
			right: 24rpx;
			top: 239rpx;
			width: 100rpx;
			height: 100rpx;
			color: $uni-text-color-inverse;
			background: #49B9AD;
			border-radius: 180rpx;
			text-align: center;
			line-height: 100rpx;
			box-shadow: 0 2px 12px 0 rgba(73, 185, 173, .8);
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.grid-text {
			margin-top: 30rpx;
		}

		.gridActive {
			opacity: 0.3;
			-webkit-filter: grayscale(100%);
			-moz-filter: grayscale(100%);
			-o-filter: grayscale(100%);
			filter: grayscale(100%);
			filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);

		}

		.grid-Item {
			margin-bottom: 30rpx;

			.gridBox {
				text-align: center;

			}

			.badgeBox {
				position: relative;

				.appointmentNumBadge {
					position: absolute;
					right: 0;
					top: 0;
					z-index: 100;
				}

				.totalNoreadnum {
					position: absolute;
					right: 0;
					top: 0;
					z-index: 100;
				}
			}

		}

		.popupBox {
			width: 360rpx;
			height: 360rpx;
			padding: 100rpx 20rpx 0;

			.u-button {
				margin-bottom: 40rpx;
				width: 280rpx;
				height: 80rpx;
			}

		}

		.pagesMain-content {
			padding: 30rpx 22rpx;
			margin-top: 30rpx;
			background: $uni-bg-color;

			&_title {
				position: relative;
				font-size: 28rpx;
				padding-left: 40rpx;
				line-height: 1;
				margin-bottom: 40rpx;
				font-weight: 700;

				&_tip {
					color: red;
					font-size: 24rpx;
					margin-left: 40rpx;
					display: flex;
				}

				&_dec {
					color: red;
					font-size: 24rpx;
					margin-left: 40rpx;
					margin-bottom: 40rpx;
					// padding:10rpx;
					// background-color: $uni-color-main;
				}
			}

			&_title.active {
				margin-bottom: 10rpx;
			}

			&_title:after {
				position: absolute;
				width: 8rpx;
				top: -2rpx;
				height: 32rpx;
				content: "";
				left: 0;
				border-radius: 20rpx;
				background-color: $uni-color-main;
			}
			.appointmentPhoneListBox{
				margin-top: -30rpx;
			}


		}

		.pagesMain-content-ann {
			padding: 0 22rpx;
			border-top: 2rpx solid #F3F3F3;
			border-bottom: 2rpx solid #F3F3F3;
		}

		.doctor {
			margin-top: 25rpx;
			padding: 30rpx 23rpx;
			background: $uni-bg-color;
			border-radius: 8rpx;

			&_title {
				font-size: 28rpx;
				font-weight: 700;

			}

			&_icon {
				font-size: 18rpx;
				color: $uni-color-main;
			}

			&_list {
				&_content {
					padding: 31rpx 0rpx;
				}

				&_item:last-child {
					margin-right: 0rpx;
				}

				&_item.active {
					border: 3rpx solid $uni-color-main;
				}

				&_item {
					border: 3rpx solid $uni-bg-color;
					width: 195rpx;
					height: 129rpx;
					margin-right: 38rpx;
					border-radius: 8rpx;

					&_img {
						width: 100%;
						height: 100%;
						border-radius: 8rpx;
					}
				}

				&_info {
					width: 100%;
					height: 120rpx;
					background: $uni-bg-three-color;
					padding: 17rpx 22rpx;

					&_content {
						font-size: 20rpx;
						color: $uni-text-color;
						line-height: 30rpx;
					}
				}
			}
		}





		.notice {
			margin-top: 25rpx;

			border-radius: 8rpx;
			overflow: hidden;
			background-color: $uni-bg-color;

			&_tab {
				width: 100%;
				height: 77rpx;

				&_item {
					height: 77rpx;
					width: 100%;
					background: $uni-color-main;
					color: $uni-bg-color;

					&_content {
						height: 77rpx;
					}

					&_text {
						margin-left: 10rpx;
						font-size: 24rpx;
						font-weight: 600rpx;
					}
				}

				&_item.active {
					background: $uni-bg-color;
					color: $uni-color-main;
				}
			}

			&_content {
				padding: 20rpx 26rpx;
				font-size: 22rpx;
				line-height: 39rpx;
			}
		}
	}
</style>